const statusEnum = {
  PAUSED: "暂停",
  LOADING: "资源加载中",
  UPLOADING: "正在上传",
  AWAITING: "等待中",
  SUCCESS: "上传成功",
  FAIL: "上传失败",
  COMBINED: "资源整合中",
};

/**
 * 创建枚举
 *
 * @param {Object} definition 枚举定义
 * @returns {Object} 枚举对象
 */
function createEnum(definition) {
  const strTokeyMap = {};

  for (const key in definition) {
    strTokeyMap[key] = key;
  }

  return {
    ...strTokeyMap,
    getDesc: (v) => definition[v] || "",
  };
}

/**
 * @typedef {Object} statusEnum
 * @description 文件上传状态枚举
 */
export default createEnum(statusEnum);
